<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>天禾人才</title>
	<meta name="format-detection" content="telephone=no">
	<meta name="viewport" content="minimal-ui=yes,width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<meta name="msapplication-tap-highlight" content="no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">

	<link rel="stylesheet" type="text/css" href="css/public.css">
	<link rel="stylesheet" type="text/css" href="css/login.css">
	
</head>
<body>
	<div class="header">
		<div class="top">
			<div class="sn-nav-back">
				<a href="javascript:;" onclick="javascript:history.back(-1);"><img src="img/back.png"></a>
			</div>
			<div class="sn-nav-title of">登录</div>
		</div>
	</div>
	<div class="container">
		<!-- <img src="img/login.jpg"> -->
		<div class="content">
			<div class="login">
				<ul>
					<li>
						<i class="username"></i>
						<input id="phone" name="phone" placeholder="用户名/手机号" type="text" value="">
					</li>

					<li>
						<i class="password"></i>
						<input id="password" name="password" placeholder="密码" type="password" value="">
					</li>
					<li>
						<h3 style="margin-left: 10%;"><a href="javascript:;" id="toLogin">登录</a></h3>
						<h3><a href="register.html">注册</a></h3>
					</li>
				</ul>
			</div>
		</div>
		<div class="bottom">
			<p><a class="forget" href="password.html">忘记密码？</a></p>
		</div>
	</div>
</body>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/base.js"></script>
<script type="text/javascript">
$("#toLogin").click(function() {
	toLogin();
});

function toLogin() {
	var phone = $("#phone").val();
	var pwd = $("#password").val();
	if(phone == null || phone == ""){
		alert("请输入手机号");
		return;
	}
	if(pwd == null || pwd == ""){
		alert("请输入密码");
		return;
	}
	var rememberMe = $("#rememberMe:checked").val();
	$.ajax({
		type: "POST",
		url: "/user/login",
		data:{
			"phone" : phone,
			"pwd" : pwd
		},
		dataType:"json",
		async:false,
		success: function(data){
			if(data.code == 0){
				localStorage.setItem('user_info',JSON.stringify(data.data));
				window.location.href="index.html";
			}else{
				alert(data.msg);
				return false;
			}
		}
	});
}

</script>
</html>